/**
 * Created with JetBrains PhpStorm.
 * User: DuyLam
 * Date: 8/22/13
 * Time: 4:53 PM
 * To change this template use File | Settings | File Templates.
 */

/********************** mo dropdown menu tren giao dien mobile khi bam vao bieu tuong menu ****************************/
$(function(){
    var co = 0;
    $("#cot1 img").click(function(){
        /* alert("abc");*/
        if(co == 0){
            $("#menu #head-phone .dropdown-menu").show();
            co = 1;
        } else {
            $("#menu #head-phone .dropdown-menu").hide();
            co = 0;
        }

    });

});

/********************************************* xu ly nut back to top **************************************************/

$('.toTopLink').bind('click',function(){
    $('html, body').animate({
        scrollTop:0
    }, $(window).scrollTop() / 2);
    return false;
});

/***************** bieu tuong mui ten back to top chi xuat hien khi trang web da truot xuong tren 600px ***************/
$(window).bind('scroll', function(){
    checkScrollPos();
});
checkScrollPos();

function checkScrollPos() {
    if ($(window).scrollTop() > 600) {
        $('.toTopLink').fadeIn(1000);
    } else {
        $('.toTopLink').fadeOut(1000);
    }
}

/******************************************************** xy ly slide *************************************************/

$(function(){
    $('.carousel').carousel();
});

